#pragma once

#include "OptionsDlg.h"

class CQipOptions : public COptionsDlg
{
	PluginSpecific* m_pData;

public:
	void Init
		( IN LPARAM lParam
		)
	{
		m_pData = (PluginSpecific*)lParam;
	}

	bool IsStatusEnabled()
	{
		return !!m_pData->Bool1;
	}

	void SetStatusEnabled
		( IN bool bEnabled
		)
	{
		m_pData->Bool1 = bEnabled;
	}

	_tstring GetUserName()
	{
		return m_pData->Wstr1? _tstring(ATL::CW2TEX<256>(m_pData->Wstr1)): _T("");
	}

	void SetUserName
		( IN const _tstring& strUserName
		)
	{
		::SysFreeString(m_pData->Wstr1);
		m_pData->Wstr1 = strUserName.empty()? NULL: ::SysAllocString(ATL::CT2WEX<256>(strUserName.c_str()));
	}

	bool IsPasswordEmpty()
	{
		return m_pData->Wstr2 && ::SysStringLen(m_pData->Wstr2);
	}

	void SetPasswordHash
		( IN const std::string& strPasswordHash
		)
	{
		::SysFreeString(m_pData->Wstr2);
		m_pData->Wstr2 = strPasswordHash.empty()? NULL: ::SysAllocString(ATL::CA2WEX<256>(strPasswordHash.c_str()));
	}
};
